function setTimes() {
	 var ctimer;
	 var now = new Date();
	 var year = now.getYear();
	 var month = now.getMonth() + 1;
	 var date = now.getDate();
	 var hours = now.getHours();
	 var minutes = now.getMinutes();
	 var seconds = now.getSeconds();
	 var day = now.getDay();
	 var Day = [];
	 Day[0]="星期天";
	 Day[1]="星期一";
	 Day[2]="星期二";
	 Day[3]="星期三";
	 Day[4]="星期四";
	 Day[5]="星期五";
	 Day[6]="星期六";
	 var timeValue = "";
	 timeValue += year + "年";
	 timeValue += ((month < 10) ? "0" : "") + month + "月";
	 timeValue += ((date < 10) ? "0" : "") + date + "日  ";
	 timeValue += (Day[day]) + "  ";
	 timeValue += (hours);
	 timeValue += ((minutes < 10) ? ":0" : ":") + minutes;
	 timeValue += ((seconds < 10) ? ":0" : ":") + seconds;
	 $("#id_timeBar").html(timeValue);	
	 ctimer =  setTimeout("setTimes()",1000);
}
function resetMenu(){
	$("#id_mainMenu > li > a").removeClass("menuhover");
	$("#subMenu").empty();
	
	if(!menuId) return;
	$("#menu_"+menuId).addClass("menuhover");
	showSubMenu("#menu_"+menuId, menuId);
}
function showSubMenu(o, pid){
	var sMenu = $('<ul></ul>').append($("#subMenu_ul").children("li[value="+pid+"]").clone());
	$("#subMenu").empty().append(sMenu);
	
	var p = $(o).offset();
	sMenu.css({
		left: (p.left - sMenu.outerWidth()/2 + $(o).outerWidth()/2)+"px",
		top: (p.top + $(o).outerHeight()+1) + "px"
	});
}
var iMenuTimer = 0;
var menuId = "";
$(function(){
	menuId = $("#id_menu_item").val();
	$("#id_mainMenu > li").mouseover(function(){
		if(iMenuTimer != 0){
			clearTimeout(iMenuTimer);
		}
		
		$("#id_mainMenu > li > a").removeClass("menuhover");
		$(this).children("a").addClass("menuhover");
		var pid = $(this).attr("value");
		showSubMenu(this, pid);
	}).mouseout(function(){
		if(iMenuTimer != 0){
			clearTimeout(iMenuTimer);
		}
		iMenuTimer = setTimeout("resetMenu()",200);
	});
	$("#subMenu").mouseover(function(){
		if(iMenuTimer != 0){
			clearTimeout(iMenuTimer);
		}
	}).mouseout(function(){
		if(iMenuTimer != 0){
			clearTimeout(iMenuTimer);
		}
		iMenuTimer = setTimeout("resetMenu()",200);
	});
	
	resetMenu();
	setTimes();
});
